const EventAggregator = require ('./EventAggregator.js');
const tls = require ('tls');
const fs = require ('fs');

class GateWayDevice {
  constructor () {
    this.disconnectFromServer = function (cb) {
      eventAggregator.publish ('deviceBreakLink', this);
    };
  }
  get name () {
    return 'gateWay';
  }
  connectToServer() {
    var option = {
      key: fs.readFileSync(__dirname + '/client/client-key.pem'),
       cert: fs.readFileSync(__dirname + '/client/client-cert.pem'),
      host: '127.0.0.1',
      port: 18231,
    };
    return tls.connect (option, function () {
      console.log ('connect to Tcpserver');
    })
  }
}
module.exports = GateWayDevice;
